<div>
    <fieldset>
        <legend>Читатели</legend>

        <div class="PageMenu">
            <button id="AddReaderA">Добавить читателя</button>
        </div>

        <div class="PageMenu">
            <div style="display: inline; padding-right: 0.4em; padding-left: 0.4em">Поиск</div>
                <?php echo $this->TypeField()->ToHtml(); ?>

            <input type="text" id="SearchValue" style="width: 23em"/>
            <label for="Debtor">
                <input type="checkbox" id="debetor" style="vertical-align: middle"/>
                    только должники</label>
        </div>

        <div><?php echo $this->UserListSwitch(); ?></div>

    </fieldset>

    <script type="text/javascript">
        jsun.run(function() {

        jsun("#AddReaderA").jsun.event({ onclick: AddReader });
        jsun("#SearchValue").jsun.event({ onkeyup: FindReader });
        jsun("#debetor").jsun.event({ onchange: FindReader });

        var pref = "ReaderList",
            param = "u=Lib&m=Lib\\Reader/ReaderListPage";

        function AddReader() {
            var dlg = new jsun.dialog({ title: "Новый читатель"});
            jsun.html.insert(dlg.content.v, jsun.html.sync_load("u=Lib&m=Lib\\Reader/Add"))
            return dlg.show();
        }

        function FindReader() {
            jsun.swap[pref].Page = 1;
            jsun.swap[pref].Req = param + jsun.page.get_data()
                + '&debetor=' + jsun('#debetor').checked;
            jsun.swap[pref].Start();
        }

        FindReader();

        });
    </script>
</div>